﻿@model TruckingApplication.Dal.EntityModels.RESOURCE

@{
    ViewBag.Title = "Delete";
}

<div id="lowerContainer">
	<div id="lowerContainerInner">

<h3>Are you sure you want to delete this?</h3>
    <fieldset>
        <table id="tableMgmt" style="width: 100%;">
            <tr>
                <td>
                    <div class="display-label">First Name</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.firstName)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">lastName</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.lastName)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">address</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.address)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">city</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.city)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">state</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.state)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">zip</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.zip)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">startDate</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.startDate)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">ssNum</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.ssNum)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">taxID</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.taxID)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">email</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.email)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">phone</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.phone)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">commission</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.commission)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">RESOURCE_TYPE</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.RESOURCE_TYPE.resourceType)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">mcNumber</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.mcNumber)
                </td>
            </tr>
            <tr>
                <td>
                    <div class="display-label">factoringFee</div>
                </td>
                <td colspan="3">
                        @Html.DisplayFor(model => model.factoringFee)
                </td>
            </tr>
            @{
                if (Model.TRAILERs != null)
                {
                    foreach (TruckingApplication.Dal.EntityModels.TRAILER trailer in Model.TRAILERs)
                    { 
                        <tr>
                            <th colspan="4" style="border-top:2px solid #Blue;"><h3>Trailer Information</h3></th>
                            </tr>
                            <tr>
                            <th style="border-top:2px solid #000;">Trailer Type</th>
                            <th style="border-top:2px solid #000;">Vin #</th>
                            <th style="border-top:2px solid #000;">Mileage</th>
                            <th></th>
                            </tr>
                            <tr>
                            <td>
                                @trailer.TRAILER_TYPE.type
                            </td>
                            <td>
                                @trailer.vin
                            </td>
                            <td>
                                @trailer.mileage
                            </td>
                        </tr>
            
                           if (trailer.TRAILER_LOG != null)
                           {
                               if (trailer.TRAILER_LOG.Count > 0)
                               {
                                   var count = 0;
                                   foreach (TruckingApplication.Dal.EntityModels.TRAILER_LOG log in trailer.TRAILER_LOG)
                                   {
                                    <tr>
                                        if(count == 0){
                                            <th colspan="4" style="border-top:2px solid #Blue;"><h3>Trailer Log</h3></th>
                                            </tr>
                                            <tr>
                                            <th style="border-top:2px solid #Blue;">Date</th>
                                            <th style="border-top:2px solid #Blue;">Previous Mileage</th>
                                            <th style="border-top:2px solid #Blue;" colspan="2">Current Mileage</th>
                                            </tr>
                                            <tr>
                                        }
                                        <td>@log.LOG.logDate.ToString()</td>
                                        <td>@log.LOG.previousMileage.ToString()</td>
                                        <td colspan="2">@log.LOG.currentMileage.ToString()</td>
                                    </tr>
                                       count++;
                                   }
                               }
                           }

                           if (trailer.ROADSIDE_ASSISTANCE != null)
                           {
                               List<TruckingApplication.Dal.EntityModels.ROADSIDE_ASSISTANCE> roadsides = trailer.ROADSIDE_ASSISTANCE.ToList();

                               foreach (TruckingApplication.Dal.EntityModels.ROADSIDE_ASSISTANCE roadside in roadsides)
                               { 
                                    <tr>
                                        <th colspan="4" style="border-top:2px solid #Blue;"><h3>Roadside Assistance Information</h3></th>
                                        </tr>
                                        <tr>
                                        <th style="border-top:2px solid #Blue;">Start Date</th>
                                        <th style="border-top:2px solid #Blue;">End Date</th>
                                        <th style="border-top:2px solid #Blue;">Payment Terms</th>
                                        <th style="border-top:2px solid #Blue;">Payment Amount</th>
                                        </tr><tr>
                                        <td>
                                            @roadside.startDate
                                        </td>
                                        <td>
                                            @roadside.endDate
                                        </td>
                                        <td>
                                            @roadside.paymentTerms
                                        </td>
                                        <td>
                                            @roadside.paymentAmount
                                        </td>
                                    </tr>
                                }
                           }

                           if (trailer.INSURANCEs != null)
                           {

                               List<TruckingApplication.Dal.EntityModels.INSURANCE> insurances = trailer.INSURANCEs.ToList();
                           
                               foreach (TruckingApplication.Dal.EntityModels.INSURANCE insurance in insurances)
                               { 
                                    <tr>
                                        <th colspan="4" style="border-top:2px solid #Blue;"><h3>Insurance Information</h3></th>
                                        </tr>
                                        <tr>
                                        <th style="border-top:2px solid #Blue;">Start Date</th>
                                        <th style="border-top:2px solid #Blue;">End Date</th>
                                        <th style="border-top:2px solid #Blue;">Payment Terms</th>
                                        <th style="border-top:2px solid #Blue;">Payment Amount</th>
                                        </tr><tr>
                                        <td>
                                            @insurance.startDate
                                        </td>
                                        <td>
                                            @insurance.endDate
                                        </td>
                                        <td>
                                            @insurance.paymentTerms
                                        </td>
                                        <td>
                                            @insurance.paymentAmount
                                        </td>
                                    </tr>
                                }
                           }
                    }
                }
            }
        
            <tr>
                <td colspan="4">
                    <input type="submit" value="Delete" class="button default btnLarge" />
                    @Html.ActionLink("Cancel", "Dashboard", "Account", null, new { @class = "button cancel btnLarge" })
                </td>
            </tr>
            
        </table>
    </fieldset>

    </div>
</div>